const app = getApp()
const $api = require('../../utils/api.js').API;
var WxParse = require('../../wxParse/wxParse.js');
Page({
    data: {
       info:{},
       imgUrl:app.globalData.imgUrl
    },
    onLoad: function(e) {
        this.getinfo(e.id)
    },
    getinfo:function(id){
        var data = {'id':id}
        var that = this
        $api.get('news/info',data).then(res => {
            //console.log(res)
            //请求成功
            if(res.data.code == 1){
                var article = res.data.data.content;
                WxParse.wxParse('article', 'html', article,that, 5,that.data.imgUrl);
                that.setData({
                    info:res.data.data
                })
            }
        }).catch(err => {
            //请求失败
            //console.log('error','请求失败');
        })
    },
    
    onShareAppMessage: function() {
        return {
            title: this.data.info.title+'--天意美业直通车',
            path: "/pges/index/index?puid="+wx.getStorageSync('uid')
        };
    },
});